﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AuriaCompte.Lib.Dao;

namespace AuriaCompte.Fenetre
{
    public partial class MotDePasseFichierDeCompte : ComponentFactory.Krypton.Toolkit.KryptonForm
    {
        private bool retour = false;

        public MotDePasseFichierDeCompte()
        {
            InitializeComponent();
        }

        public bool Montre()
        {
            this.ShowDialog();
            return this.retour;
        }

        private void kBtnAnnuler_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void kBtnValider_Click(object sender, EventArgs e)
        {
            DaoDb dao = new DaoDb();
            if (dao.Select().Password == this.kTbPassword.Text)
            {
                retour = true;
                this.Close();
            }
            else
                ComponentFactory.Krypton.Toolkit.KryptonTaskDialog.Show("Erreur", string.Empty, "Mot de passe invalide", MessageBoxIcon.Error, ComponentFactory.Krypton.Toolkit.TaskDialogButtons.OK);
        }
    }
}
